<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>CSS3属性选择器的使用</title>
    <style type="text/css">
        /*此段代码只是让结构更美观，后续会详细讲解*/
        .demo a {
            float: left;
            display: block;
            height: 50px;
            width: 50px;
            border-radius: 10px;
            text-align: center;
            background: #aac;
            color: blue;
            font: bold 20px/50px Arial;
            margin-right: 5px;
            text-decoration: none;
            margin: 5px;
        }

        /* 包含title属性的a元素 */
        a[title] {
            background-color: aqua;
        }

        /* 属性值以s开头的a元素 */
        a[href^=s]{
            background-color: blueviolet;
        }
        /* 属性值以com结尾的a元素 */
        a[href$=com] {
            background-color: brown;
        }


        /* 属性值以包含a的a元素 */
        a[href*=a] {
            width:300px;
            height:300px;
        }
     
    </style>
</head>
<body>
    <p class="demo">
        <a href="http://www.baidu.com" class="links item first" id="first" >1</a>
        <a href="" class="links active item" title="test website" target="_blank" >2</a>
        <a href="sites/file/test.html" class="links item"  >3</a>
        <a href="sites/file/test.png" class="links item" > 4</a>
        <a href="sites/file/image.jpg" class="links item" >5</a>
        <a href="efc" class="links item" title="website link" >6</a>
        <a href="/a.pdf" class="links item" >7</a>
        <a href="/abc.pdf" class="links item" >8</a>
        <a href="abcdef.doc" class="links item" >9</a>
        <a href="abd.doc" class="linksitem last" id="last">10</a>
    </p>
</body>
</html>